Ext.define('TS.view.base.ProductList' ,{
    extend: 'Ext.grid.Panel',
    alias : 'widget.productlist',
    title : '商品资料',
    columnLines: true,
    bodyPadding:0,
    frame : true,//面板渲染
    closable: true,
    store:'base.ProductStore',
    /* fields: ['productId', 'classifyId','repositoryId','productCode','productName',
    'packSpec', 'manufId','manuf','unit','innerPack',
    'boxPack', 'abc','qtyScale','priceScale',
    'deleted', 'virtual','licenseNo','batchMgr','barcode','remark'
    ]	*/
    columns:[
            {header: '商品编号', dataIndex: 'productCode',width:80},
            {header: '商品名称', dataIndex: 'productName',width:200},
            {header: '规格', dataIndex: 'packSpec', width:50},
            {header: '生产企业', dataIndex: 'manuf',width:100},
            {header: '单位', dataIndex: 'unit',width:60},
            {header: '中包装数量', dataIndex: 'innerPack', width:80},
            {header: '箱装数量', dataIndex: 'boxPack',width:80},
            {header: 'ABC', dataIndex: 'abc',width:40},
            {header: '是否批号管理', dataIndex: 'batchMgr',width:80,xtype : "booleancolumn",trueText:'是',falseText:'否'},
            {header: '是否虚拟商品', dataIndex: 'virtual',width:80,xtype : "booleancolumn",trueText:'是',falseText:'否'},
            {header: '批准文号', dataIndex: 'licenseNo',width:80},
            {header: '条码', dataIndex: 'barcode',width:80},
            {header: '备注', dataIndex: 'remark',width:100},
            {header: '数量小数位', dataIndex: 'qtyScale',width:50},
            {header: '价格小数位', dataIndex: 'priceScale',width:50},
            {header: '税率', dataIndex: 'taxRate',width:50},
            {header: '类别', dataIndex: 'classifyId',width:50,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.productClassify))
            			return '';
					return record.raw.productClassify.classifyName;
				}
            }
    ],
    tbar :[
				{xtype:'button',action:'add',text:'添加',iconCls:'bill-add-button'},
				{xtype:'button',action:'upd',text:'修改',iconCls:'bill-edit-button'},
				{xtype:'button',action:'del',text:'删除',iconCls:'bill-delete-button'},
				{
					xtype: 'triggerfield',
					labelWidth :50,
					fieldLabel:'查询:',
					width:250,
					margin:'0,0,10,10',
					emptyText:'请输入商品编码或名称',
					trigger1Cls:Ext.baseCSSPrefix + "form-search-trigger",
					onTriggerClick:function(e){
						e.keyCode=e.ENTER;//设置为Enter事件
						this.fireEvent('specialkey',this,e);//点客户查询图标执行搜索
					}
				},{
					xtype:'button',action:'manuf',text:'生产企业',iconCls:'bill-link-button'
				},
				{xtype:'button',action:'recycle',text:'回收站',iconCls:'bill-recycle-button'},
				{xtype:'button',action:'restore',text:'还原',iconCls:'bill-restore-button'},
				{xtype:'button',action:'exportxls',text:'导出',iconCls:'bill-export-button'},
				{xtype:'button',action:'ref',text:'刷新',iconCls:'bill-ref-button'}
		   ],
	dockedItems :[{
				xtype:'pagingtoolbar',
				store:'base.ProductStore',
				dock:'bottom',
				displayInfo:true
	}],
	selType:'checkboxmodel',//设定选择模式
	multiSelect:true,//运行多选
	initComponent:function(){
		this.callParent(arguments);
	},
	listeners: {
		render:{
			fn:function(){
				/*this.store.load({
					params:{val:"all"},
		    		callback:function(records, operation, success){
		    		},
			   		scope: this
			   	});*/
			}
		}
	}
});
